<{include file="public/header" /}>
 <!-- <script type="text/javascript">
function up(x){
    //var stu=document.getElementById("studel");
    var sname=x.getAttribute('v');
    if(confirm('确定要上传成绩到 ['+sname+'] 中吗？')){
    return true;
    }else{
    return false;
    }
  }

</script> -->
<body>
<div class="layui-container" style="margin-top: 30px;">
    <div class="layui-row">
      <div class="layui-col-md12">
        <center><b><h2><{$banji.title}></h2></b></center>
         <hr class="layui-bg-green">
             
            
              <br>
              
              <button type="button" class="layui-btn" id="upstu">
                <i class="layui-icon">&#xe67c;</i>上传表格
              </button>
              <br><br><br>
             <div class="layui-progress" lay-showPercent="yes" lay-filter="demo">
              <div class="layui-progress-bar layui-bg-green" lay-percent="0%"></div>
            </div>
              <br>
             <hr class="layui-bg-green">
             <button type="button" class="layui-btn" id="import">
                <i class="layui-icon"></i>导入
              </button>
              <!-- <input type="submit" value="导入" class="layui-btn" onclick="return up(this);" v="<{$banji.title}>"/> -->
          
            
        
      </div>
    </div>
</div>

 <script>
layui.use(['upload','layer','element'], function(){
  var upload = layui.upload,layer=layui.layer,element=layui.element;
   var cid='<{$banji.cid}>';
  //执行实例
  var uploadInst = upload.render({
    elem: '#upstu' //绑定元素
    ,url: '<{:url('import')}>' //上传接口
    ,accept:'file'
    ,exts:'xls|xlsx'
    ,data: {cid:cid}
    ,auto:false
    ,acceptMime:'.xlsx,.xls'
    ,bindAction: '#import'
    ,progress: function(n, elem){
    var percent = n + '%' //获取进度百分比
    element.progress('demo', percent); //可配合 layui 进度条元素使用
    
    //以下系 layui 2.5.6 新增
    console.log(elem); //得到当前触发的元素 DOM 对象。可通过该元素定义的属性值匹配到对应的进度条。
    }
    ,done: function(res){
      //上传完毕回调
    if(res.code == 1){
        layer.msg('导入成功!',{icon: 6,time:1000},function(index){
             x_father_close();
             parent.location.reload();
        });
      //do something （比如将res返回的图片链接保存到表单的隐藏域）
    }else{
        layer.alert(res.code+'请关闭刷新重试！');
    }
    }
  });
});
</script>
 
 

</body>
</html>